package com.sunlands.qdcy.deskmate.enums;

/**
 * Created by ajGeGe
 */
public enum InsertOptStatus {

    success("success",1),
    failed("failed",0),
    exist("exist",-1),
    error("error",-2);

    private InsertOptStatus(String info, int code) {
        this.info = info;
        this.code = code;
    }

    private String info;
    private int code;

    public String getInfo() {
        return info;
    }

    public void setInfo(String info) {
        this.info = info;
    }

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public static InsertOptStatus getInsertOptStatusByInfo(String info) {
        for (InsertOptStatus field : InsertOptStatus.values()) {
            if (info!=null && info.equals(field.getInfo())) {
                return field;
            }
        }
        return null;
    }

    public static InsertOptStatus getInsertOptStatusByCode(int code) {
        for (InsertOptStatus field : InsertOptStatus.values()) {
            if (code == field.getCode()) {
                return field;
            }
        }
        return null;
    }
}
